package com.hhu.wangzb.common.entity.filter;

import java.util.List;
import java.util.Map;

public class OmitFilter implements Filter {

    // 优先级，数字越大越优先执行
    private final int priority = 10;

    @Override
    public Map<String, Object> doFilter(Map<String, Object> entityMap, FilterEntity filterEntity) {

        List<String> omit = filterEntity.getOmit();

        if (omit == null || omit.size() == 0) return entityMap;

        for (String s : filterEntity.getOmit()) {
            entityMap.remove(s);
        }

        return entityMap;
    }

    @Override
    public int getPriority() {
        return priority;
    }
}
